package com.example.testdbsearchform;

import java.util.List;

import android.app.Application;

public class CustomApplication extends Application {
	
	List<Category> categories = null;
	private static CustomApplication instance;
	
	@Override
	public void onCreate() {
		super.onCreate();
		
		instance = this;
	}
	
	public static CustomApplication getInstance() {
		return instance;
	}

	public List<Category> getCategories() {
		return categories;
	}
	
	public Category getCategory(long id) {
		for (Category item : categories) {
			if (item.getId() == id) {
				return item;
			}
		}
		return null;
	}
	
	public void setCategories(List<Category> categories) {
		this.categories = categories;
	}
	
	@Override
	public void onLowMemory() {
		// TODO Auto-generated method stub
		super.onLowMemory();
	}

	
	

}
